package com.zyg.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zyg.pojo.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMapper extends BaseMapper<Student> {

    @Select("SELECT s_id, student_num, student_name, gender, age, date_of_birth, class_id, hotel_id, phone, email, home_address, emergency_contact, emergency_contact_phone, major, status, del_flag, create_by, create_time, update_by, update_time, remark FROM student_info WHERE class_id = #{id}")
    @Results({
            @Result(property = "sid", column = "s_id"),
            @Result(property = "studentNum", column = "student_num"),
            @Result(property = "studentName", column = "student_name"),
            @Result(property = "gender", column = "gender"),
            @Result(property = "age", column = "age"),
            @Result(property = "birthday", column = "date_of_birth"),
            @Result(property = "classId", column = "class_id"),
            @Result(property = "hotelId", column = "hotel_id"),
            @Result(property = "phone", column = "phone"),
            @Result(property = "email", column = "email"),
            @Result(property = "homeAddress", column = "home_address"),
            @Result(property = "emergencyContact", column = "emergency_contact"),
            @Result(property = "emergencyContactPhone", column = "emergency_contact_phone"),
            @Result(property = "major", column = "major"),
            @Result(property = "status", column = "status"),
            @Result(property = "delFlag", column = "del_flag"),
            @Result(property = "createBy", column = "create_by"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateBy", column = "update_by"),
            @Result(property = "updateTime", column = "update_time"),
            @Result(property = "remark", column = "remark")
    })
    List<Student> selectListByClassId(Long id);
}